<template>
  <div class="content">
    <HeaderView @searchingBtn="searchingBtn" />
    <div class="table-t">人员档案</div>
    <div class="table-left">
      <div class="left-aside">
        <div
          class="aside-img"
          :class="activeImg == index ? 'img-active' : ''"
          v-for="(listItem, index) in imgList"
          :key="index"
        >
          <img
            v-if="listItem.personPicUrl"
            :src="
              listItem.personPicUrl
                ? '/httpImage/' + listItem.personPicUrl
                : '@/assets/images/search/nobody.png'
            "
            fit="fill"
          />
          <img v-else src="@/assets/images/search/nobody.png" fit="fill" />
        </div>
      </div>
    </div>
    <div class="table-right">
      <div class="card_list">
        <div class="card-item-box" v-for="(item, index) in tableData" :key="index">
          <div class="card-item">
          <div class="adress">
            <span>{{ item.cameraAddr || "小区--" }}</span>
          </div>
          <div class="image_box">
            <img v-if="item.picSmUrl" :src="'/httpImage/' + item.picSmUrl" />
            <img v-else src="@/assets/images/search/nobody.png" fit="fill" />
          </div>
          <div class="adress">
            <span>{{ item.likeDate2 || "2023-12-22" }}</span>
          </div>
          </div>
        </div>
      </div>
      <div class="btn-pager">
        <PagerView
          class="page"
          :pageSizes="[15, 30]"
          layout="sizes, prev, pager, next"
          :pager-options="pagerOptions"
          v-on="pagerEvents"
        />
      </div>
    </div>
    <!-- 预览图片 -->
    <PreviewImageDialog :edit-common-config="editConfig" />
  </div>
</template>

<script>
import HeaderView from "@/views/investigateBusiness/components/headerView";
import pageMixin from "@/components/makepager/pager/mixin/pageMixin";
import PreviewImageDialog from "@/views/panoramicData/components/PreviewImageDialog";
// import {
//   getPersonDocumentInfo,
//   getSearchList,
// } from "@/api/statisticsQueryManage/portraitFilingPage"
// import NewDate from "@/api/date"
// const { formatDate2 } = NewDate
export default {
  name: "portraitFilingPage",
  mixins: [pageMixin],
  props: {},
  components: {
    HeaderView,
    PreviewImageDialog,
  },
  data() {
    return {
      url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      tableData: [
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
        {
          url: "",
        },
      ],
      imgList: [
        {
          personPicUrl: "",
        },
        {
          personPicUrl: "",
        },
        {
          personPicUrl: "",
        },
        {
          personPicUrl: "",
        },
      ],
      activeImg: 0,
      portraitFilingDetailsForm: {
        searchTime: [
          this.$moment(new Date())
            .subtract(1, "months")
            .format("YYYY-MM-DD 00:00:00"),
          this.$moment().format("YYYY-MM-DD 23:59:59"),
        ],
        page: 1,
        size: 15,
        sort: "desc",
        documentNumber: "",
      },
      pagerOptions: {
        currPage: 1,
        pageSize: 15,
        totalCount: 0,
      },
      editConfig: {
        visible: false,
        infomation: [],
        personIndex: 0,
        currentId: "",
        isLookImg: false,
        tabs: [],
      },
    };
  },
  mounted() {
    this.getInfo();
    this.getData();
  },
  watch: {},
  methods: {
    searchingBtn(form) {
      // 上面的搜索列表
      this.portraitFilingDetailsForm.searchTime = form.searchTime
        ? [
            this.$moment(form.searchTime[0]).format("YYYY-MM-DD HH:mm:ss"),
            this.$moment(form.searchTime[1]).format("YYYY-MM-DD HH:mm:ss"),
          ]
        : [];
      this.portraitFilingDetailsForm.sort = form.orderType;
      this.getData();
    },
    async getInfo() {
      let params = {};
      params.id = this.$route.query.id;
      // var res = await getPersonDocumentInfo(params)
      // this.personInfo = res.data || {}
      // this.personInfo.lastAppearanceTime = formatDate2(this.personInfo.lastAppearanceTime * 1000)
    },
    async getData() {
      // this.portraitFilingDetailsForm.page = this.pagerOptions.currPage
      // this.portraitFilingDetailsForm.size = this.pagerOptions.pageSize
      // let params = JSON.parse(JSON.stringify(this.portraitFilingDetailsForm))
      // params.documentNumber = this.$route.query.id
      // var res = await getSearchList(params)
      // const arr = res.data.datalist || []
      // this.tableData = arr || []
      // this.pagerOptions.totalCount = res.data.total
    },
    detailsBtn(data, index) {
      this.editConfig.isLookImg = true;
      let sanpObj = this.tableData[index].activeObject;
      this.editConfig.infomation = this.tableData;
      this.editConfig.currentId = sanpObj.id;
      this.editConfig.personIndex = index;
      this.editConfig.noLookMore = true;
      this.editConfig.visible = true;
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
  overflow-y:hidden;
  .table-t {
    width: 130px;
    height: 33px;
    line-height: 33px;
    font-size: 14px;
    text-align: center;
    background-image: url("@/assets/images/investigateBusiness/dayLurkNight-big.png");
    background-size: 100% 100%;
    // background-size: contain;
    background-repeat: no-repeat;
    margin-top: 20px;
  }
  .table-left {
    width: 300px !important;
    height: calc(100% - 53px - 53px - 10px - 30px);
    box-sizing: border-box;
    // height: unset !important;
    // padding:10px;
    margin-right: 35px;
    background-image: url("@/assets/images/background_aside.jpg");
    background-size: 100% 100%;
    // background-size: contain;
    background-repeat: no-repeat;
    /* 不重复背景图片 */
    float: left;
    margin-top: 10px;
    overflow: auto;
    .left-aside {
      padding: 15px 18px;
      min-height: 350px;
      background-color: rgba(154, 193, 240, 0.2);
      border-radius: 4px;
      width: 228px;
      margin: 20px auto 10px;
      height: calc(100% - 70px);
      .aside-img {
        width: 66px;
        height: 66px;
        margin: 0 auto;
        border-radius: 4px;
        box-sizing: border-box;
        overflow: hidden;
        float: left;
        margin-right: 10px;
        margin-bottom: 10px;
        img {
          width: 100%;
          height: 100%;
        }
        &:hover {
          border: 1px solid #33fefe;
        }
      }
      .img-active {
        border: 1px solid #33fefe;
      }
    }
  }
  .table-right {
    width: calc(100% - 300px - 35px);
    height: calc(100% - 53px - 53px - 10px - 30px);
    float: left;
    margin-top: 10px;
  }
  .card_list {
    width: 100%;
    height: calc(100% - 50px);
    overflow-y: auto;
    margin: 0 auto;
    .card-item-box{
      width:14.2%;
      float:left;
    }
    .card-item {
      width: 146px;
      height:164px;
      box-sizing: border-box;
      opacity: 1;
      background: #2e5eab;
      box-shadow: inset 0px 1px 15px 0px rgba(3, 251, 255, 0.6);
      border-radius: 8px;
      cursor: pointer;
      position: relative;
      margin-bottom: 24px;
      &:nth-of-type(3n) {
        // margin-right:0;
      }
      .adress {
          font-size: 12px;
          height: 28px;
          line-height: 28px;
          width:100%;
          color:#E0EAFF;
          box-sizing: border-box;
          margin: 0px;
          padding: 0px 10px;
      }
      .image_box {
        width: 146px;
        height: 108px;
        display: inline-block;
        cursor: pointer;
        .el-image,
        img {
          width: 100%;
          height: 100%;
          display: inline-block;
          border: 0;
          font-size: 0;
          object-fit:cover;
          box-sizing: border-box;
          color: rgba(46, 94, 171, 0.3);
        }
      }
    }
  }
  .btn-pager {
    width: calc(100% - 40px);
    justify-content: left;
    position: relative;
  }
}
</style>
